package com.example.controller;

import com.example.entity.Student;
import com.example.service.impl.StudentServiceImpl;
import com.example.utils.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Author:yanghua
 * Date:2023/11/2 10:04
 */
@RestController
public class LoginController {
    @Resource
    private StudentServiceImpl studentService;

    @GetMapping("login")
    public R loginJudge(@RequestParam("username") String username, @RequestParam("password") String password, @RequestParam("type") Integer type) {
        if (type == 1) {
            // 学生端
            return studentService.loginStudent(username, password);
        } else if (type == 2) {
            // 教师端
        } else {
            // 管理员端 3
        }

        return R.error("登录失败");
    }
}
